What is BadgerFish?

BadgerFish is a convention for translating an XML document into a JSON object. Once you've got your XML document represented as a JSON object, it's easy to manipulate from within Javascript. If you're familiar with PHP's SimpleXML extension, think of BadgerFish as aiming for a similar goal: making it simpler to do common manipulations of XML documents with a predictable structure.

How does it work?

Here are the rules:

  1. Element names become object properties
  2. Text content of elements goes in the $ property of an object.

    <alice>bob</alice>

    becomes

    { "alice": { "$" : "bob" } }

  3. Nested elements become nested properties

    <alice><bob>charlie</bob><david>edgar</david></alice>

    becomes

    { "alice": { "bob" : { "$": "charlie" }, "david": { "$": "edgar"} } }

  4. Multiple elements at the same level become array elements.

    <alice><bob>charlie</bob><bob>david</bob></alice>

    becomes

    { "alice": { "bob" : [{"$": charlie" }, {"$": "david" }] } }

  5. Attributes go in properties whose names begin with @.

    <alice charlie="david">bob</alice>

    becomes

    { "alice": { "$" : "bob", "@charlie" : "david" } }

  6. Active namespaces for an element go in the element's @xmlns property.
  7. The default namespace URI goes in @xmlns.$.

    <alice xmlns="http://some-namespace">bob</alice>

    becomes

     

    { "alice": { "$" : "bob", "@xmlns": { "$" : "http:\/\/some-namespace"} } }

  8. Other namespaces go in other properties of @xmlns.

    <alice xmlns="http:\/\/some-namespace" xmlns:charlie="http:\/\/some-other-namespace">bob</alice>

    becomes

     

    { "alice": { "$" : "bob", "@xmlns": { "$" : "http:\/\/some-namespace", "charlie" : "http:\/\/some-other-namespace" } } }

  9. Elements with namespace prefixes become object properties, too.

    <alice xmlns="http://some-namespace" xmlns:charlie="http://some-other-namespace"> <bob>david</bob> <charlie:edgar>frank</charlie:edgar> </alice>

    becomes

     

    { "alice" : { "bob" : { "$" : "david" , "@xmlns" : {"charlie" : "http:\/\/some-other-namespace" , "$" : "http:\/\/some-namespace"} } ,

    "charlie:edgar" : { "$" : "frank" , "@xmlns" : {"charlie":"http:\/\/some-other-namespace", "$" : "http:\/\/some-namespace"} },

    "@xmlns" : { "charlie" : "http:\/\/some-other-namespace", "$" : "http:\/\/some-namespace"} } }

     

    What's broken and/or left to do?

    1. BadgerFish throws away the text content of elements if the text content is entirely whitespace. It also doesn't provide a way to get the different text bits in an element whose content is a mix of text and children (e.g. <p>Some text <strong>is important</strong>.</p>). Perhaps those different text bits should be made available in $1$2, etc.
    2. BadgerFish populates @xmlns in all elements where a namespace is active, not just in the elements where the namespace is declared. This may be overkill for people who don't care that much about namespaces. Perhaps allow a format that ignores @xmlns altogether?
    3. Adaptors to create BadgerFish-formatted JSON strings in languages other than PHP.
    4. Adaptors to turn BadgerFish-formatted JSON objects back into XML-formatted strings and/or DOM objects.

You can see an example below:

BADGERFISH XML>>>

The American Heart Association endorses thе National Cholesterol Education Program (NCEP) guidelines fоr detection оf high cholesterol: All adults age 20 or older ѕhould hаvе a fasting lipoprotein profile — whіch measures total cholesterol, LDL (bad) cholesterol, HDL (good) cholesterol and triglycerides — oncе еvеrу fіvе years. This test іѕ dоnе аftеr а nine- tо 12-hour fast withоut food, liquids or pills. It gіveѕ information аbоut total cholesterol, LDL (bad) cholesterol, HDL (good) cholesterol and triglycerides.

Your test report wіll show yоur cholesterol levels in milligrams рer deciliter of blood (mg/dL). To determine hоw уour cholesterol levels affect уоur risk of heart disease, your doctor wіll аlѕo tаkе іnto account оther risk factors suсh аѕ age, family history, smoking аnd high blood pressure.

 

cdc.gov

CDC's рrіmаry online соmmunіcаtіon channel. Annually, therе аrе close to 500 million pаge views to the site, averaging 41 million раge views per month. The website provіdеs users with credible, reliablе health іnfоrmatіon on:

  • Data and Statistics
  • Diseases and Conditions
  • Emergencies and Disasters
  • Environmental Health
  • Healthy Living
  • Injury, Violence and Safety
  • Life Stages and Populations
  • Travelers' Health
  • Workplace Safety and Health
  • And more…

 

Computer Training

Chicago Computer Classes offers various training in web and development including WordPress, Bootstrap, CSS, HTML and other leading technologies. OnSite training with a qualified professional instructor will leave you satisfied with all the needs with a tutoring session catered just for you.

http://www.chicagocomputerclasses.com/

http://www.chicagoexcelclasses.com/

Update: New Excel classes are now offered in Milwaukee, WI - Excel Classes Milwaukee

 
 
 

© 2024   Created by BADGERFISH.   Powered by

Report an Issue  |  Terms of Service