473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how do you evalute a xpath query with xml tag like this <bac:BACne

i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 17 '06 #1
5 1994
What are you using to try to access the node in this XPath? Is this XSL or .NET? Is the bac namespace actually defined (i.e. xmlns:bac="something")?
--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 17 '06 #2
hello, i'm using .Net XmlDocument withh xpath query to access the xml file,
yes the bac is point to http://www.teletrol.com/BACnet but the file is not
there. there is a xsd in the local hard disk.

is this the namespace binding?

thank you
"Greg Collins [Microsoft MVP]" wrote:
What are you using to try to access the node in this XPath? Is this XSL or .NET? Is the bac namespace actually defined (i.e. xmlns:bac="something")?
--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 18 '06 #3
i use XMLSPY to evaluate the xpath query before i use it in my code. i use
VB.net w/Visual Studio.net 2005. if i add a nameperfix in the InstanceNumber
node bac:InstanceNumber then this query will work

/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@bac:InstanceNumber

how do i get the value of InstanceNumber without adding "bac:" to the
InstanceNumber node on the xml file.

here is the xml file that i'm working with

<Site InstanceNumber="7415">
<ActionGroups/>
<Bookmarks AllowCreate="1" AllowDelete="1">
<Bookmark Name="HomePage" Path="800.7415_316.11_311.1094"/>
</Bookmarks>
<EquipmentCatalogs AllowCreate="0" AllowDelete="1" AllowRename="0">
<EquipmentCatalog InstanceNumber="133">
<GeneralProperties Attr="1" InstanceNumber="133" IsConfigured="0"
ObjectName="H280_Strake_Jesuit" ObjectType="317" SchemaVer="1.4"
TraceOptions="0">
<Description/>
</GeneralProperties>
</EquipmentCatalog>
</EquipmentCatalogs>
<GeneralProperties Attr="1" InstanceNumber="7415" IsConfigured="0"
ObjectName="H280_Strake_Jesuit" ObjectType="800" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[eBuilding Main Site]]></Description>
</GeneralProperties>
<Networks>
<Network InstanceNumber="101">
<bac:BACnetDevices xmlns:bac="http://www.teletrol.com/BACnet">
<bac:BACnetDevice APDUTimeout="" ApplicationSoftwareVersion=""
FirmwareRevision="" InstanceNumber="3744" MaxAPDULengthAccepted=""
ModelName="" NumberOfAPDURetries="" ProtocolConformanceClass=""
ProtocolObjectTypesSupported="" ProtocolServicesSupported=""
ProtocolVersion="" SegmentationSupported="" VendorIdentifier="" VendorName="">
<GeneralProperties Attr="1" InstanceNumber="3744" IsConfigured="0"
ObjectName="Building_1" ObjectType="8" SchemaVer="1.4" TraceOptions="0">
<Description/>
</GeneralProperties>
</bac:BACnetDevice>
</bac:BACnetDevices>
<GeneralProperties Attr="0" InstanceNumber="101" IsConfigured="0"
ObjectName="Network" ObjectType="801" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
<NetworkControllers>
<NetworkController InstanceNumber="115" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="115" IsConfigured="1"
ObjectName="H280_Strake_Jesuit_Plant" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 110]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="116" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="116" IsConfigured="1"
ObjectName="H280_Strake_Jesuit_Ahu" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 110]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="1264" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="1264" IsConfigured="0"
ObjectName="H280_Strake_Jesuit_FH" ObjectType="8" SchemaVer="1.4"
TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 120. (Field House controller)
]]></Description>
</GeneralProperties>
</NetworkController>
<NetworkController InstanceNumber="3764" InternalType="10">
<GeneralProperties Attr="1" InstanceNumber="3764" IsConfigured="0"
ObjectName="eNC_Model_130" ObjectType="8" SchemaVer="1.4" TraceOptions="0">
<Description><![CDATA[Teletrol Systems, Inc. eBuilding Network
Controller model 130]]></Description>
</GeneralProperties>
</NetworkController>
</NetworkControllers>
<NetworkProperties NetworkNumber="1" ProtocolName="">
<Description/>
<PropertiesEx/>
</NetworkProperties>
</Network>
</Networks>
<Queries/>
<SharedObjects/>
<SiteProperties IpAddress="" NextInstanceNumber="3771" SiteServerVersion=""/>
<Facility FacilityIndexURL="" IndexPageURL="" InstanceNumber="11"
minimizedMenu="0" showAlarmIcon="1" showMenu="1" showSaveIcon="1">
<GeneralProperties Attr="1" InstanceNumber="11" IsConfigured="0"
ObjectName="Facility" ObjectType="316" SchemaVer="1.4" TraceOptions="">
<Description><![CDATA[Set of Facility Pages]]></Description>
</GeneralProperties>
</Facility>
<Globals InstanceNumber="3">
<GeneralProperties Attr="1" InstanceNumber="3" IsConfigured="0"
ObjectName="Globals" ObjectType="201" SchemaVer="1.4" TraceOptions="0">
<Description><![CDATA[Location for all Global System
Objects]]></Description>
</GeneralProperties>
</Globals>
</Site>
"dotnetnoob" wrote:
i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 18 '06 #4
i got it. by using namespace manager the xpath query work in my VB.net code.

"dotnetnoob" wrote:
i got xml file that have <bac:BACnetDevicesand <bac:BACnetDevicetag how
do you make a xpath query with that type of tags

this is the query that i come up with
/Site/Networks/Network/bac:BACnetDevices/bac:BACnetDevice/@InstanceNumber

but i got "undefined namespace prefix -'bac'" error
Jul 18 '06 #5
Glad you got it working!

--
Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Jul 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: gfrommer | last post by:
Hello Everyone, I'm writing a server in java, and I want the clients to pass me an XPath query. I want the XPath queries to be in a specific format though, I'm pretty sure it's valid but I want...
2
by: R | last post by:
Hello everybody. I'm new to XML and I've got problem with one XPath query. This is my situation: <group> <test required='1'></test> <test required='1' noregexp='1'></test> </group> inside...
2
by: David Gordon | last post by:
Hi Folks, I wonder if anyone can help me with the following (perhaps trivial) problem: <xml> <node name="a" type="a"/> <node name="b" type=""/> <node name="c"/> <node name="d" type="b"/>...
3
by: IMS.Rushikesh | last post by:
Hi Friends, I need a XPath query, whcih ll return me subset of data.... check below xml stream <label id="MyExpenseDetails_lbl" xlink:role="terseLabel">Short Expense Details</label> <label...
2
by: dc | last post by:
i have a xml file like this: <?xml version="1.0" encoding="utf-8"?> <validate xmlns="http://tempuri.org/fieldValidate.xsd"> <field name="Short Name" type="SN" length="10"> <requiredChar...
0
by: dotnetnoob | last post by:
Dim strFacilitFile As String = Func_Facilit(strJobSite) Dim xTempltDoc As New Xml.XmlDocument Dim xGpDoc As New Xml.XmlDocument Dim y As Integer = 0 'Dim intNxtInstNumb As Integer =...
2
by: Claudio | last post by:
Hi I'm trying to use XPath queries with streaming XML, but I cannot make it working. The solution I'm trying to implement is: create a XmlNode as soon as I have a full XML element and use the...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
2
by: =?Utf-8?B?RGlmZmlkZW50?= | last post by:
Hello All, I am trying to construct an XPath query against an XML document, for a requirement that I have. Below is the XML fragment: <SUBMISSIONS> <SUBMISSION YEAR="2004"> <MONTH...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.