Bug with XML namespace
See original GitHub issueI am having a problem with the XML namespace selector. It is not returning any results. I am using XML mode, and I’m escaping the :
character, like so:
let entry = cheerio.load(options.data, {
xmlMode: true
});
$(entry).find('apnm\\:ManagementId').text(); // returns undefined
My XML
<entry xmlns="http://www.w3.org/2005/Atom">
<id>urn:publicid:ap.org:6181ace1f2d7425ab2a240d6a603e396</id>
<title>US--LGBT Rights</title>
<updated>2016-08-22T14:36:23.750Z</updated>
<published>2016-08-22T14:35:56Z</published>
<author>
<name>AP</name>
</author>
<rights>Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.</rights>
<content type="text/xml" xml:lang="en-US">
<nitf version="-//IPTC//DTD NITF 3.4//EN" change.date="October 18, 2006" change.time="19:30" xmlns="">
<head>
<docdata>
<doc-id regsrc="AP" />
<date.issue norm="20160822T143556Z" />
<ed-msg info="Eds: Updates with background, comment from Texas attorney general. Edits. New to some points. Will be updated." />
<doc.copyright holder="AP" year="2016" />
</docdata>
</head>
<body>
<body.head>
<hedline>
<hl1 id="headline">Judge in Texas temporarily blocks Obama's transgender rules</hl1>
<hl2 id="originalHeadline">Judge in Texas temporarily blocks Obama's transgender rules</hl2>
</hedline>
<byline>By PAUL J. WEBER<byttl>Associated Press</byttl></byline>
<distributor>The Associated Press</distributor>
<dateline>
<location>AUSTIN, Texas</location>
</dateline>
</body.head>
<body.content>
<block id="Main">
<p>AUSTIN, Texas (AP) — A federal judge in Texas is blocking for now the Obama administration's directive to U.S. public schools that transgender students must be allowed to use the bathrooms and locker rooms consistent with their chosen gender identity.</p>
<p>On Monday — the first day of class for most public schools in Texas — hundreds of school districts awoke to news of the order by U.S. District Judge Reed O'Connor.</p>
<p>His decision dated Sunday comes after Texas and 12 other states challenged the Obama directive as unconstitutional. O'Connor ruled that the federal education law, Title IX, "is not ambiguous" about sex being defined as "the biological and anatomical differences between male and female students as determined at their birth."</p>
<p>He also sided with Republican state leaders who argued that schools should have been allowed to weigh in before the directive was announced in May.</p>
<p>Texas Attorney General Ken Paxton, a Republican, had argued that halting the law before school began was necessary because districts risked losing federal education dollars if they didn't comply. Federal officials didn't explicitly make that threat upon issuing the directive, although they also never ruled out the possibility.</p>
<p>"This president is attempting to rewrite the laws enacted by the elected representatives of the people, and is threating to take away federal funding from schools to force them to conform," Paxton said. "That cannot be allowed to continue, which is why we took action to protect states and school districts."</p>
<p>The Education and Justice departments did not immediately react to the injunction.</p>
<p>Paul Castillo, a Dallas attorney for the gay rights group Lambda Legal that had urged the court to let the directive stand, said the ruling was a continuation of attacks on transgender people.</p>
<p>"I think today is going to be a hard day for transgender students," Castillo said. "The decision is certainly emotional, and certainly an attack on transgender students' dignity."</p>
<p>The federal government told U.S. public schools in May that transgender students must be allowed to use bathrooms and locker rooms consistent with their chosen gender identity. That announcement came days after the Justice Department sued North Carolina over a state law that requires people to use public bathrooms that correspond with the sex on their birth certificate, which U.S. Attorney General Loretta Lynch had likened to policies of racial segregation. Republicans have argued such laws are commonsense privacy safeguards.</p>
<p>The Obama administration had told the court that recipients of federal education dollars "are clearly on notice" that antidiscrimination polices must be followed. Texas alone gets roughly $10 billion in federal education funds.</p>
<p>The lawsuit was filed in May by Texas, Alabama, Wisconsin, West Virginia, Tennessee, Oklahoma, Louisiana, Utah and Georgia, and the Republican governors of Maine, Mississippi and Kentucky. Two small school districts in Arizona and Texas, which have fewer than 600 students combined and no transgender persons on their campuses, also joined the effort to prevent the directive from being enforced.</p>
<p>__</p>
<p>Follow Paul J. Weber on Twitter: www.twitter.com/pauljweber</p>
</block>
</body.content>
<body.end />
</body>
</nitf>
</content>
<link rel="alternate" title="AP Article" href="http://www.apnewsarchive.com/2016/A-federal-judge-in-Texas-has-temporarily-blocked-an-Obama-administration-directive-on-bathroom-rights-for-transgender-students-in-public-schools/id-fc9eb93fd45f4629b7813bdb5f5f1821" />
<link rel="enclosure" title="AP Article" href="http://syndication.ap.org/AP.Distro.ContentBroker2/ContentBroker.aspx?contentid=dc9fdc2dc1e34051a50ecba4895095e4&iid=fc9eb93fd45f4629b7813bdb5f5f1821&rsn=3&recordid=6181ace1f2d7425ab2a240d6a603e396&filingId=3bd75a8f71f3487b9fdd32ec2f300796&role=Main&reldt=2016-08-22T14:35:56&media=Text&sz=3344&dest=cb&showInlineLinks=False&semiColonAnpa=False&semiColonNITF=False&broadcastAnpa=False&onlineAnpa=True&trF=j2132&aid=00000000000000000000c610cee58283&agV=WFA+v3.4&fmt=13&authToken=eNoNyDsKwzAMANATOUj%2bSoPOUhxLAUOhpiGkgw7fLG94bj%2bpqUKjxAwVAChy8zFFBx86ooaBlkKGgqEXsDD2nokLcLHsn6mSayP065T%2bfU993bYfZnr6NSVhxhZ93dIXYvW5hGl7amuP9AfhtCS%2b" length="3304" type="application/octet-stream">
<apcm:Characteristics IngestLink="True" ContentId="urn:publicid:ap.org:dc9fdc2dc1e34051a50ecba4895095e4" FilingId="urn:publicid:ap.org:3bd75a8f71f3487b9fdd32ec2f300796" FileExtension="anpa" Format="ANPA1312" MediaType="Binary" MimeType="application/octet-stream" Role="Main" SizeInBytes="3304" Words="851" xmlns:apcm="http://ap.org/schemas/03/2005/apcm" />
</link>
<link rel="enclosure" title="AP Article" href="http://syndication.ap.org/AP.Distro.ContentBroker2/ContentBroker.aspx?contentid=dc9fdc2dc1e34051a50ecba4895095e4&iid=fc9eb93fd45f4629b7813bdb5f5f1821&rsn=3&recordid=6181ace1f2d7425ab2a240d6a603e396&filingId=3bd75a8f71f3487b9fdd32ec2f300796&role=Main&reldt=2016-08-22T14:35:56&media=Text&sz=3344&dest=cb&showInlineLinks=False&semiColonAnpa=False&semiColonNITF=False&broadcastAnpa=False&onlineAnpa=True&trF=j2132&aid=00000000000000000000c610cee58283&agV=WFA+v3.4&fmt=14&authToken=eNoNyDsKwzAMANATOUj%2bSoPOUhxLAUOhpiGkgw7fLG94bj%2bpqUKjxAwVAChy8zFFBx86ooaBlkKGgqEXsDD2nokLcLHsn6mSayP065T%2bfU993bYfZnr6NSVhxhZ93dIXYvW5hGl7amuP9AfhtCS%2b" length="3304" type="application/octet-stream">
<apcm:Characteristics IngestLink="True" ContentId="urn:publicid:ap.org:dc9fdc2dc1e34051a50ecba4895095e4" FilingId="urn:publicid:ap.org:3bd75a8f71f3487b9fdd32ec2f300796" FileExtension="iptc" Format="IPTC7901" MediaType="Binary" MimeType="application/octet-stream" Role="Main" SizeInBytes="3304" Words="851" xmlns:apcm="http://ap.org/schemas/03/2005/apcm" />
</link>
<link rel="enclosure" title="AP Article" href="http://syndication.ap.org/AP.Distro.ContentBroker2/ContentBroker.aspx?contentid=dc9fdc2dc1e34051a50ecba4895095e4&iid=fc9eb93fd45f4629b7813bdb5f5f1821&rsn=3&recordid=6181ace1f2d7425ab2a240d6a603e396&filingId=4fb41c2d9e774ef0b9f9394440ce806b&role=Main&reldt=2016-08-22T14:35:56&media=Text&sz=3344&dest=cb&showInlineLinks=False&semiColonAnpa=False&semiColonNITF=False&broadcastAnpa=False&onlineAnpa=True&trF=j2132&aid=00000000000000000000c610cee58283&agV=WFA+v3.4&fmt=15&authToken=eNoNyDsKwzAMANATOUj%2bSoPOUhxLAUOhpiGkgw7fLG94bj%2bpqUKjxAwVAChy8zFFBx86ooaBlkKGgqEXsDD2nokLcLHsn6mSayP065T%2bfU993bYfZnr6NSVhxhZ93dIXYvW5hGl7amuP9AfhtCS%2b" type="text/html">
<apcm:Characteristics IngestLink="True" ContentId="urn:publicid:ap.org:dc9fdc2dc1e34051a50ecba4895095e4" FileExtension="html" Format="hNews" MediaType="Text" MimeType="text/html" Role="Main" xmlns:apcm="http://ap.org/schemas/03/2005/apcm" />
</link>
<link rel="enclosure" title="AP Article" href="http://syndication.ap.org/AP.Distro.ContentBroker2/ContentBroker.aspx?contentid=62bf7370d65c4be8b1de8a4aa474fb0f&iid=fc9eb93fd45f4629b7813bdb5f5f1821&rsn=3&recordid=6181ace1f2d7425ab2a240d6a603e396&filingId=4fb41c2d9e774ef0b9f9394440ce806b&role=Main&reldt=2016-08-22T14:35:56&media=Text&sz=3304&dest=cb&showInlineLinks=False&semiColonAnpa=False&semiColonNITF=False&broadcastAnpa=False&onlineAnpa=True&trF=j2132&aid=00000000000000000000c610cee58283&agV=WFA+v3.4&fmt=15&authToken=eNoNyMEKwyAMANAvsiTqknjItwytEYTBZKV0h3x8e3mH5%2fZXSgQsqRQgAJBY2PepFNvgxBA6vfaQm0lo2C1IzbVmzqPB8O%2fsmokF%2fTy0%2fj6zvy9rw6wffk5NmJGjr0vrQiSfS4tsT238KDfhfyTx" type="text/html">
<apcm:Characteristics IngestLink="True" ContentId="urn:publicid:ap.org:62bf7370d65c4be8b1de8a4aa474fb0f" FileExtension="html" Format="hNews" MediaType="Text" MimeType="text/html" Role="Main" xmlns:apcm="http://ap.org/schemas/03/2005/apcm" />
</link>
<apcm:ContentMetadata xmlns:apcm="http://ap.org/schemas/03/2005/apcm">
<apcm:DateLineLocation City="Austin" Country="USA" CountryArea="TX" CountryAreaName="Texas" CountryName="United States" />
<apcm:Priority Numeric="3" Legacy="u" />
<apcm:ConsumerReady>TRUE</apcm:ConsumerReady>
<apcm:ByLine Title="Associated Press">By PAUL J. WEBER</apcm:ByLine>
<apcm:DateLine>AUSTIN, Texas</apcm:DateLine>
<apcm:ExtendedHeadLine>A federal judge in Texas has temporarily blocked an Obama administration directive on bathroom rights for transgender students in public schools</apcm:ExtendedHeadLine>
<apcm:HeadLine>Judge in Texas temporarily blocks Obama's transgender rules</apcm:HeadLine>
<apcm:OriginalHeadLine>Judge in Texas temporarily blocks Obama's transgender rules</apcm:OriginalHeadLine>
<apcm:Keywords>US--LGBT Rights</apcm:Keywords>
<apcm:Cycle>BC</apcm:Cycle>
<apcm:Selector>alal-</apcm:Selector>
<apcm:LegacyTypeSetFormat>bx</apcm:LegacyTypeSetFormat>
<apcm:TransmissionReference>j2132</apcm:TransmissionReference>
<apcm:SlugLine>BC-US--LGBT Rights,2nd Ld-Writethru</apcm:SlugLine>
<apcm:DistributionScope>State</apcm:DistributionScope>
<apcm:ContentElement>FullStory</apcm:ContentElement>
<apcm:MediaType>Text</apcm:MediaType>
<apcm:EntityClassification Authority="AP Party" Value="Ken Paxton" Id="1e7a517b4d97453d931bb1159cdc97ae">
<apcm:Property Id="c9d7fa107e4e1004847adf092526b43e" Name="PartyType" Value="POLITICIAN" />
<apcm:Property Id="d188b8b8886b100481accb8225d5863e" Name="PartyType" Value="PERSON" />
</apcm:EntityClassification>
<apcm:EntityClassification Authority="AP Party" Value="Loretta Lynch" Id="d5ef153564cc41de93acbf72b7b68364">
<apcm:Property Id="5d2fb70d2c364c15968bf7651362602f" Name="PartyType" Value="GOVERNMENT_FIGURE" />
<apcm:Property Id="d188b8b8886b100481accb8225d5863e" Name="PartyType" Value="PERSON" />
</apcm:EntityClassification>
<apcm:EntityClassification Authority="AP Geography" Value="United States" Id="661e48387d5b10048291c076b8e3055c" />
<apcm:EntityClassification Authority="AP Geography" Value="Texas" Id="6e92d9b882c7100488e5df092526b43e" />
<apcm:EntityClassification Authority="AP Geography" Value="North America" Id="661850e07d5b100481f7c076b8e3055c" />
<apcm:EntityClassification Authority="AP Organization" Value="Texas Attorney General's Office" Id="da57b6a07c1a486baf871824c84fd87f" />
<apcm:EntityClassification Authority="AP Organization" Value="Texas state government" Id="6b776ffaf2814540ac9bf9c3e37e5a06" />
<apcm:EntityClassification Authority="AP Region" Id="EURO" />
<apcm:EntityClassification Authority="AP Region" Id="BRIT" />
<apcm:EntityClassification Authority="AP Region" Id="SCAN" />
<apcm:EntityClassification Authority="AP Region" Id="MEST" />
<apcm:EntityClassification Authority="AP Region" Id="AFRI" />
<apcm:EntityClassification Authority="AP Region" Id="INDI" />
<apcm:EntityClassification Authority="AP Region" Id="ASIA" />
<apcm:EntityClassification Authority="AP Region" Id="ENGL" />
<apcm:SubjectClassification System="Editorial" Authority="AP Category Code" Value="n" Id="n" />
<apcm:SubjectClassification System="Editorial" Authority="AP Subject" Value="General news" Id="f25af2d07e4e100484f5df092526b43e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Primary and secondary education" Id="42a74195df1645dda692dba5db2416d4" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="National courts" Id="16fbfab0893c10048e06ba0a2b2ca13e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Gender issues" Id="570831e088701004882deb2e0e616f0b" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Education" Id="1af99ec3cb954ff4b349b32d60d0376d" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Social affairs" Id="75a42fd87df7100483eedf092526b43e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Social issues" Id="08680bf085af10048c4f9a5aeba5fb06" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Human rights and civil liberties" Id="008e219885ab10048110ff2260dd383e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="National governments" Id="3942e1139d10439a8243b8633edc550e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Government and politics" Id="86aad5207dac100488ecba7fa5283c3e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Courts" Id="86ba17607dac1004894eba7fa5283c3e" />
<apcm:SubjectClassification System="Machine" Authority="AP Subject" Value="Judiciary" Id="86b9d8e07dac1004894dba7fa5283c3e" />
<apcm:ItemContentType>Spot Development</apcm:ItemContentType>
<apcm:Source>AP</apcm:Source>
<apcm:Property Name="EntitlementMatch" Id="urn:publicid:ap.org:package:100373" Value="MC Complete - State & National" />
<apcm:Property Name="EntitlementMatch" Id="urn:publicid:ap.org:product:30023" Value="AP Alabama State News - No Weather " />
<apcm:Property Name="SequenceNumber" Value="InSequence" Id="400414635" />
<apcm:FirstCreated>2016-08-22T14:35:54Z</apcm:FirstCreated>
</apcm:ContentMetadata>
<apnm:NewsManagement xmlns:apnm="http://ap.org/schemas/03/2005/apnm">
<apnm:ManagementId>urn:publicid:ap.org:fc9eb93fd45f4629b7813bdb5f5f1821</apnm:ManagementId>
<apnm:ManagementSequenceNumber>3</apnm:ManagementSequenceNumber>
<apnm:PublishingStatus>Usable</apnm:PublishingStatus>
<apnm:PublishingSpecialInstructions>Eds: Updates with background, comment from Texas attorney general. Edits. New to some points. Will be updated.</apnm:PublishingSpecialInstructions>
<apnm:PublishingReleaseDateTime>2016-08-22T14:35:50Z</apnm:PublishingReleaseDateTime>
<apnm:LegacyNewsManagement>
<apnm:LegacyType>ANPA1312+NAA89-3</apnm:LegacyType>
<apnm:LegacyManagementType Value="Lead">
<apnm:TypeSupportingData DataType="LeadNumber">2</apnm:TypeSupportingData>
</apnm:LegacyManagementType>
</apnm:LegacyNewsManagement>
</apnm:NewsManagement>
</entry>
Sorry it’s so massive, I don’t want to leave anything out. Any query for anything that has an XML namespace returns undefined or has 0 results.
Querying the normal elements works well though.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Bug #4996: Namespace information missing from default XML ...
This case (source code/schema etc. attached in zip file) uses Java 1.8 with the default built-in Apache Xerces parser. The parser is configured ......
Read more >Bug #1849618 “Addition of “:” in the xml namespace as xmlns ...
Hi, Using BeautifulSoup version 4.4.1 Python : sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0) lxml.etree : (4, 4, 1, ...
Read more >XML Namespace IssueWith Error "java.lang.Exception
This bug is in the Weblogic patch (M2RW-BUG20780188_1211012.jar) and exists regardless of JRockit version. After the patch, some correctly ...
Read more >166055 – Wrong XML namespace
This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's ...
Read more >SP2 XmlRendering Bug? Unused XML Namespace Inserted
A discrepancy of particular consequence was the insertion of a new XML namespace in the root element: xmlns: p1="http://www.w3.org/2001/XMLSchema-instance".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any progress on this?
I know it is old issue but I findout that double escape
\\
works e.g.