How to parse this textfile
I have a plan textfiel that i'm able to read but i can't parse the date and numbers in the text file.
text content: [ 2007.10.19 11:53:42 ] (test) <color=0xffbbbb00>Your item, costs 598.0 euro.
i suppose i can use substring/tokenizer but my knowledge in the tokenizer is limited.
Does anyone know how to parse the date and costs so i can show the total costs for an item?
mkoryak wrote:
import java.util.regex.*;
holy regex, batman! I definitely have to devote more time to regex. My mere mortal solution to some of the extractions went along these lines:
private Color getColor(String text)
Color c = null;
String[] strArr = text.split("[<>]");
// the forum mangles this :(
// it should have angle brackets inside of square brackets.
String colorStr = strArr[1];
colorStr = colorStr.substring(colorStr.indexOf("=") + 3);
int[] colorInts = new int[4];
for (int i = 0; i < colorInts.length; i++)
String colorSubStr = colorStr.substring(2 * i, 2 * i + 2);
colorInts[i] = Integer.parseInt(colorSubStr, 16);
c = new Color(colorInts[0], colorInts[1], colorInts[2], colorInts[3]);
return c;
private Date getDate(String text)
Date d = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
String[] dateStrArr = text.split("[\\[\\]]");
String dateStr = dateStrArr[1].trim();
try
d = sdf.parse(dateStr);
catch (ParseException e)
e.printStackTrace();
return d;
}I will definitely study your code mkoryak, thanks.
Edited by: petes1234 on Oct 24, 2007 10:09 AM
Similar Messages
-
How to parse this kind of XML documents and store in a relational tables
Can u guys help me out ,..how to parse these kind of XML documents..like under PR there Sr,CreationDate and DoBID.. Again under Sr...there are LD, CID,TID, RID and so on.....
so how to parse this kind of data..how to create the structure of the table....pls help me out..
<nk8:PR>
<nk8:Sr>
<nk8:LD>---------</nk8:LID>
<nk8:CID>---------</nk8:CID>
<nk8:TID>---------</nk8:TID>
<nk8:RID>---------</nk8:RID>
<nk8:CC>OnError</nk8:CC>
<nk8:AID>---------</nk8:AID>
</nk8:Sr>
<nk8:CreationDateTime>2002-07-01</nk8:CreationDateTime>
<nk8:DOBID>---------</nk8:DOBID>
</nk8:PR>
<ssm:ER>
<ssm:PN>---------</ssm:PN>
<ssm:SN>---------</ssm:SN>
<ssm:SCt>---------</ssm:SC>
<ssm:IA>
<ssm:NT>---------</ssm:NT>
<nk8:LID>---------</nk8:LID>
<nk8:CID>---------</nk8:CID>
<ssm:AN>---------</ssm:AN>
</ssm:A>
</ssm:ER>
</nk8:PR>First, your XML document is not well formatted. Once you're done with that you can extract the values and store it in a table column.
sql> WITH xml_table AS
2 (SELECT XMLTYPE(
3 '
4 <nk8:PR xmlns:nk8="http://www.w3.org">
5 <nk8:Sr>
6 <nk8:LID>LID Value</nk8:LID>
7 <nk8:CID>CID Value</nk8:CID>
8 <nk8:TID>TID Value</nk8:TID>
9 <nk8:RID>RID Value</nk8:RID>
10 <nk8:CC>OnError</nk8:CC>
11 <nk8:AID>---------</nk8:AID>
12 </nk8:Sr>
13 </nk8:PR>') XMLCOL FROM DUAL)
14 SELECT extractvalue(t.column_value,'//nk8:LID','xmlns:nk8="http://www.w3.org"') "LID",
15 extractvalue(t.column_value,'//nk8:CID','xmlns:nk8="http://www.w3.org"') "CID",
16 extractvalue(t.column_value,'//nk8:RID','xmlns:nk8="http://www.w3.org"') "RID",
17 extractvalue(t.column_value,'//nk8:CC','xmlns:nk8="http://www.w3.org"') "CC"
18 FROM xml_table, table(xmlsequence(extract(xmlcol,'/nk8:PR/nk8:Sr','xmlns:nk8="http://www.w3.org"'))) t;
LID CID RID CC
LID Value CID Value RID Value OnError -
How can parse this xml tag " Cell ID="0" Type="String" Afghanistan cell "
Hi,
I have to parse this type of xml file.
so how can i parse this type of xml file like
<Row ID="1">
<Cell ID="0" Type="String" >Afghanistan</Cell>
<Cell ID="1" Type="Number" >93</Cell>
<Cell ID="2" Type="Number" >0</Cell>
<Cell ID="3" Type="Number" >1</Cell>
</Row>You haven't given us enough information. Is this for iPhone or Mac OS X? What language are you using? etc.
-
How to parse this specific text
i am stucked in this crictical problem and i don't know how to cater this. I sometimes receive this String ����►☻☺ and sometimes these are non US-ASCII characters. These ����►☻☺ characters are replaced by ????? and is represented as it is. I sometime receive this character �� too. These characters are in ANSI list but i want to receive only US-ASCII. Please help me out that how to identify these characters in the string.
They are undoubtedly hex. Download a hex editor and view the values to see if they make sense. If you simply want to strip out the alphanumeric characters, write a simple RegEx expression.
- Saish -
I need to get the complete element including tag. How to parse this xml?
I am sure there should be some solution to this. I have XML file like this
<test>
<data value="123" color="RED">
<type>single</type>
</data>
<data value="13323" color="BLUE">
<type>double</type>
</data>
</test>
I need to parse this XML and get the data element(s). The problem is that I need to get the complete data element include tags like
"<data value="123" color="RED"><type>single</type></data>". I need to parse the complete XML file and get every data element including tag and send it to another upstream process.
Any solution to this will be appreciated. I am little familiar with SAX. Is there any solution around using xerces SAX parser.
Other solution is also appreciated.
ThanksDocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(srcFile);
NodeList list = document.getElementsByTagName("data");
Node node = list.item(0); // Loop this
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
DOMSource source = new DOMSource(node);
StreamResult result = new StreamResult(outputstream);
transformer.transform(source, result);
Using XSLT will be lot easier.No it won't. Extending DefaultHandler is easy.Do you really think so?
Hardly 10-15 lines. -
Hi Guys
I have the following xml file.
<scms:TokenDescription xmlns:scms="http://www./schema/2003/07/Passage/scms.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="SID33322800" ATR="asdfafasdfdafdasfsda" FormatVersion="1.0">
<Token SerialNumber="123456789" SmartChipSN="3232323232">
<KeySetVersion>99</KeySetVersion>
<SecurityDomainAID>fdfasfsadfsdaf</SecurityDomainAID>
<AuthenticationKey>fdasfdasfdsafsda</AuthenticationKey>
<MACKey>fdasfdsafdsaf</MACKey>
<KeyEncryptionKey>asdfasdfasdfsdafa</KeyEncryptionKey>
<DefaultPUK>fdsafsdafsdfdsafasd</DefaultPUK>
</Token>
</scms:TokenDescription>I have managed to read the xml fine and bind it manuall to an object as follows:
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File("xml.xml"));
NodeList keySetVersion = firstPersonElement.getElementsByTagName("KeySetVersion");
Element firstNameElement = (Element)keySetVersion.item(0);
NodeList textFNList = firstNameElement.getChildNodes();
System.out.println("keySetVersion : " +
((Node)textFNList.item(0)).getNodeValue().trim());My Question is can anyone tell me how i can read this part of the xml from this document the serial number and smartChipSN
<Token SerialNumber="123456789" SmartChipSN="3232323232">Try this code,
Nodelist nList = doc.getElementByTagName("Token ") ;
Element node = (Element)nList.item(0);
To read the values of "SerialNumber" and "SmartChipSN", you can use getAttribute method.
String serailNo = node.getAttribute("SerialNumber");
String chipSN = node.getAttribute("SmartChipSN"); -
How to parse this?????
i have the model of following structure html file i have to parse the values of <BR> tags how should i do this since all of them are enclosed within <Font> tag
<BODY><FONT SIZE=-1
<BR>"10100521"
<BR>"11723003"
<BR>"9011461"
<BR>"8158892"
<BR>"1603335"
<BR>"2129978"
</FONT></BODY>
there is a < BR > tag before starting of the numbers i dont know why it is not displayed here
nullA "<br>" is non-XHTML, though, so that won't work.
You're probably better off learning to use regular expressions - once you know how to use them, this sort of thing is pretty straightforward. Google for it and you'll find endless resources to help you. -
(ask) how to parse this?
Hello guys, I wonder if you can help me with this:
For example this string : '(1+4)/7'
How do I break down that string so I can found out the result of that statement?
Any input would be appreciated.
Thanks.SQL> set serveroutput on
SQL> declare
2 a number;
3 str varchar2(20) := '(3/4)*7';
4 begin
5 execute immediate 'select '||str||' from dual' into a;
6 dbms_output.put_line(a);
7 end;
8 /
5.25
PL/SQL procedure successfully completed. -
How to Parse this XML File and require below mentioned value as output using powershell script
Need values for below as an output for below xml file so help me with the script:
Under Criteria Tag-
TimeStamp Display Value
OID corresponding to display value for nodes "Criterion"
Under Report Body Tag--
name in Report Section and OID value
<?xml version="1.0" encoding="UTF-8"?>
<ReportOutput>
<ReportHead>
<Report name="Execution Action" type="detailedchanges_rpt">
<Description></Description>
</Report>
<Criteria>
<TimestampCriterion name="date" displayvalue="08/10/14 23:08">
<Timestamp displayvalue="08/10/14 23:08">1412780929000</Timestamp>
</TimestampCriterion>
<MatchCriterion name="approvalId" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="promotionComment" displayvalue="Not applied" operator="contains" />
<SelectCriterion name="changeWindow" displayvalue="Not applied" />
<SelectCriterion name="auditEvents" displayvalue="(Any)">
<String>auditEventAny</String>
</SelectCriterion>
<SelectCriterion name="attributeDisplay" displayvalue="Changed attributes">
<String>changed</String>
</SelectCriterion>
<SelectCriterion name="versionCompare" displayvalue="Version with current baseline">
<String>disabled</String>
</SelectCriterion>
<BooleanCriterion name="showContentDiff" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayUsers" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayPackages" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCustomProperties" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="strictPackageMatch" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<BooleanCriterion name="displayCriteriaAtEnd" displayvalue="No">
<Boolean value="false" />
</BooleanCriterion>
<SelectCriterion name="elementExists" displayvalue="Not applied" />
<IntegerCriterion name="maxLinesPerBlock" displayvalue="10">
<Integer>10</Integer>
</IntegerCriterion>
<NodesCriterion name="nodes" displayvalue="TripwireENT.demo.net">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
</NodesCriterion>
<MatchCriterion name="nodeName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="nodeProps" displayvalue="Not applied" />
<RulesCriterion name="rules" displayvalue="Critical System Files">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
</RulesCriterion>
<MatchCriterion name="ruleName" displayvalue="Not applied" operator="contains" />
<MatchCriterion name="elementName" displayvalue="Not applied" operator="contains" />
<CustomPropertiesCriterion name="elementProps" displayvalue="Not applied" />
<CustomPropertiesCriterion name="versionProps" displayvalue="Not applied" />
<AttributesCriterion name="attributes" displayvalue="Not applied">
<Integer name=".missingImpliesFailure">1</Integer>
</AttributesCriterion>
<ContentCriterion name="content" displayvalue="Not applied" />
<MatchCriterion name="auditEventUserName" displayvalue="Not applied" operator="contains" />
<IntegerCriterion name="changeType" displayvalue="Added, Modified, Removed">
<Integer>7</Integer>
</IntegerCriterion>
<SeverityRangeCriterion name="severity" displayvalue="1 - 10000">
<Integer name="min">1</Integer>
<Integer name="max">10000</Integer>
</SeverityRangeCriterion>
<BooleanCriterion name="currentVersionsOnly" displayvalue="Yes">
<Boolean value="true" />
</BooleanCriterion>
<TimeRangeCriterion name="timeRange" displayvalue="All time" />
<PackagesCriterion name="packages" displayvalue="Not applied" />
<SortCriterion name="sortNodes" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortRules" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortElements" displayvalue="Name, ascending" isascending="true">
<String>name</String>
</SortCriterion>
<SortCriterion name="sortVersions" displayvalue="Date, descending" isascending="false">
<String>date</String>
</SortCriterion>
</Criteria>
</ReportHead>
<ReportBody>
<ReportSection name="TripwireENT.demo.net" category="node">
<OID>-1y2p0ij32e8bw:-1y2p0ij32e7cu</OID>
<String name="typeName">Windows Server</String>
<ReportSection name="Critical System Files" category="rule">
<OID>-1y2p0ij32e7q2:-1y2p0ij31snh6</OID>
<String name="typeName">Windows File System Rule</String>
<ReportSection name="C:\Temp" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e586</OID>
<ReportSection name="08/10/14 22:48" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3ho</OID>
<Integer name="changeType">1</Integer>
<String name="changeTypeName">Added</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 22:48">1412779682000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="DACL" category="added">
<String name="observed">Inherits Entries: true
NT AUTHORITY\SYSTEM, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Administrators, Access Allowed:
Standard rights:
Full Control
Modify
Read & Execute
List Folder Contents
Read
Write
Delete
Read Control
Write DAC
Write Owner
Synchronize
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Standard rights:
Read & Execute
List Folder Contents
Read
Read Control
Synchronize
Specific rights:
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Read Permissions
Header flags:
Object Inherit
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Folders / Append Data
Header flags:
Container Inherit
Inherited
BUILTIN\Users, Access Allowed:
Specific rights:
Create Files / Write Data
Header flags:
Container Inherit
Inherited
CREATOR OWNER, Access Allowed:
Generic rights:
Generic All
Specific rights:
Full Control
Traverse Folder / Execute File
List Folder / Read Data
Read Attributes
Read Extended Attributes
Create Files / Write Data
Create Folders / Append Data
Write Attributes
Write Extended Attributes
Directory Delete Child
Read Permissions
Change Permissions
Take Ownership
Header flags:
Object Inherit
Container Inherit
Inherit Only
Inherited
</String>
</ReportSection>
<ReportSection name="Group" category="added">
<String name="observed">TRIPWIREENT\None</String>
</ReportSection>
<ReportSection name="Owner" category="added">
<String name="observed">BUILTIN\Administrators</String>
</ReportSection>
<ReportSection name="Read-Only" category="added">
<String name="observed">false</String>
</ReportSection>
<ReportSection name="SACL" category="added">
<String name="observed">(null)</String>
</ReportSection>
<ReportSection name="Type" category="added">
<String name="observed">Directory</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="C:\Windows\System32\drivers\etc\hosts" category="element">
<OID>-1y2p0ij32e8dr:-1y2p0ij32e4kp</OID>
<ReportSection name="08/10/14 23:08" category="version">
<OID>-1y2p0ij32e8du:-1y2p0ij32e3hk</OID>
<Integer name="changeType">2</Integer>
<String name="changeTypeName">Modified</String>
<Integer name="severity">10000</Integer>
<String name="severityName">High</String>
<Timestamp name="changeTime" displayvalue="08/10/14 23:08">1412780929000</Timestamp>
<String name="approvalId"></String>
<ReportSection name="attributes" category="attributes">
<ReportSection name="SHA-1" category="modified">
<String name="expected">de375d8a456a7345323babee88975ca567a2d5c4</String>
<String name="observed">3c5520382f91cb1cd898fee2da4eba3fa338d982</String>
</ReportSection>
<ReportSection name="Size" category="modified">
<String name="expected">829</String>
<String name="observed">854</String>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
</ReportSection>
<ReportSection name="reportTotals" category="reportTotals">
<Integer name="summary.nodeCount">1</Integer>
<Integer name="summary.ruleCount">1</Integer>
<Integer name="summary.elementCount">2</Integer>
</ReportSection>
</ReportBody>
</ReportOutput>Hi Ritehere,
I know this is simple but am beginner in Powershell Script so I was looking for logic to go through however the output you provided is not what i am looking for and your script is too complicated, as under timestamp i wanted display value and correspoding
to display value the OID name and then name value correspoding to that OID. May be u got it wrong.
Thanks anyways. -
effect = {{p_physical_defence;{armor_light};11.1;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};11.8;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};12.5;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};14;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};14.8;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};15.6;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};17.3;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};18.1;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};19;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};20.8;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};21.7;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};22.6;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};24.5;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};25.5;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_light};26.4;diff};{p_magic_speed;{armor_light};88;per};{p_attack_speed;{armor_light};25;per};{p_mp_regen;{armor_light};20;per}}
effect = {{p_physical_defence;{armor_heavy};14.8;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};15.6;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};16.5;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};18.3;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};19.2;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};20.2;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};22.1;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};23.1;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};24.1;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};26.2;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};27.3;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};28.4;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};30.6;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};31.8;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per
effect = {{p_physical_defence;{armor_heavy};33;diff};{p_magic_speed;{armor_heavy};68;per};{p_attack_speed;{armor_heavy};25;per}}
effect = {{i_p_attack_over_hit;123};{p_block_act}}
effect = {{i_p_attack_over_hit;131};{p_block_act}}Yeesh.
Throw some code at it and hope it works. -
How to parse XML file with namesapce?
Hi,
I am trying to parse an xml file having namespace. But no data is returned.
Sample Code:
public class XMLFileLoader
var xml:XML = new XML();
var myXML:XML = new XML();
var XML_URL:String = "file:///C:/Documents and Settings/Administrator/Desktop/MyData.xml";
var myLoader:URLLoader = null;
public function XMLFileLoader()
var myXMLURL:URLRequest = new URLRequest(XML_URL);
myLoader= new URLLoader(myXMLURL);
myLoader.addEventListener(Event.COMPLETE,download);
public function download(event:Event):void
myXML = XML(myLoader.data);
var ns:Namespace=myXML.namespace("xsi");
for(var prop:String in myXML)
trace(prop);
//Alert.show(myXML..Parameters);
//trace("Data loadedww."+myXML.toString());
//Alert.show(myXML.DocumentInfo.attributes()+"test","Message");
The XML Contains the following format.
<Network xmlns="http://www.test.com/2005/test/omc/conf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.test.com/2005/test/omc/conf/TestConfigurationEdition3proposal4.xsd">
<TestDomain>
<WAC>
<!--Release Parameter -->
<Parameters ParameterName="ne_release" OutageType="None"
accessRight="CreateOnly" isMandatory="true"
Planned="false"
Reference="true" Working="true">
<DataType>
<StringType/>
</DataType>
<GUIInfo graphicalName="Release"
tabName="All"
description="Describes the release version of the managed object"/>
</Parameters>
</TestDomain>
</Network>
Any sample code how to parse this kind of xml file with namespaces...
Regards,
Purushothami have exactly the same problem with KXml2, but using a j2me-polish netbeans project.
i've tried to work around with similar ways like you, but none of them worked. now i've spent 3 days for solving this problem, i'm a bit disappointed :( what is wrong with setting the downloaded kxml2 jar path in libraries&resources?
screenshot -
How to parse xml file, containing image, generaged from JAX-RS connector?
Hi,
We are using JAX-RS connector and just want to call getBusinessObjects() directly using JerseyMe (basically bypassing sync engine). We have used sync engine so far and want to try as how to bypass it. The method produces the text/xml and verified the xml file in the web by giving the full url. The plan is to call the same URL from the Java Me Client using JerseyMe. When I print the bytes at the client I receive the same xml that I have seen in the web. Actually, I am passing an image that I can see in a different character format in xml (assuming this is bcos of UTF-8 encoding). I am wondering as how to parse this xml file and how to decode the "UTF-8" format? Do we need to use SGMP for this or use kxml or java me webservices spec.
I would really appreciate if somebody can answer this one.
I have been observing in this forum that SGMP team is not at all active in answering the questions. Please let us know whether Oracle is keeping this product and we can continue using SGMP1.1. Please let us know so that we can plan accordingly as we are building a product based on SGMP.Hi Rajiv,
The client library is using org.apache.commons.codec.binary.Base64 internally. We don't have the full Commons Codec library bundled, but you can look up the javadoc for the Base64 class online. All you need to do is call Base64.decode(obj.getBytes()) on the objects you get out of the XML.
In general it isn't a good idea to depend on implementation details of the client library, but in this case, I think it is pretty safe to expect org.apache.commons.codec.binary.Base64 to remain in our library.
--Ryan -
How to Break this String and put into a Table
Hi all,
Currently i working on the Reading of Csv file.THe Csv file wil be stored as BLOB in one table.
The Format of the Csv file is
EMPCODE :DATEOFBIRTH
312089 ,12/01/1984
321456 ,03/05/1980
120212 ,04/08/1987
312456 ,23/12/1977
311110 ,12/04/1998
323232 ,20/06/1990
UPLOAD_BLOB
column Datatype
UploadId Number
File_details BLOB
And i reading the BLOB in one procedure and i m getting the String as like this ---->
"312089 ,12/01/1984
321456 ,03/05/1980
120212 ,04/08/1987
312456 ,23/12/1977
311110 ,12/04/1998
323232 ,20/06/1990"
I am Dont know how to Parse this String and put in table
While 1<STRING.LENGTH
LOOP
EMPCODE=SUBSTRING();
DATEOFBIRTH=SUBSTRING();
INSERT INTO TABLE VALID_EMPCODE(EMPCODE,DATEOFBIRTH)VALUES(......);END LOOP
VALID_EMPCODE
EMPCODE VARCHAR2(30)
DATEOFBIRTH VARCHAR2(15)
Can any one tell me how to parse this whole string and break themDuplicate post
How to Break this String and put into a Table -
How to parse fault detail in AxisFault
Hi Gurus,
When I am trying access third party Web Service, my client gets the service errors as AxisFault and there are some specific faults that are thrown. I have to get them to log as what exactly the problem i.e <b>FaultType:</b>,<b>FaultNumber</b>,<b>FaultDescription</b>.
<b>Could any one help me out</b> how to parse this(pls see that is there in bold). I tried following code, but I am able to display the NodeName but not the Node value. ie.
} catch (AxisFault e) {
org.w3c.dom.Element [] detailed = e.getFaultDetails();
for(int i=0;i<detailed.length;i++){
System.out.println("Node Name : "+detailed.getNodeName());
System.out.println("Node Value : "+detailed[i].getNodeValue());
System.out.println("Node Tag Name : "+detailed[i].getTagName());
System.out.println("Local Name : "+detailed[i].getLocalName());
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Undefined
faultActor:
faultNode:
faultDetail:
{http://www.mydomain.com/api/create/version/two}<b>FaultType: INVALID INPUT DOCUMENT</b>
{http://www.mydomain.com/api/create/version/two}<b>FaultNumber: 40</b>
{http://www.mydomain.com/api/create/version/two}<b>FaultDescription: The input document is not valid.</b>
Undefined
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1712)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)For a class, I am creating comments as shown below in my source code and it's displaying fine in the javadoc
* <pre>
* This is className
* </pre>
public class className
}In the same way, I am giving comments to my method, but it's not getting displayed in the Method Detail section of the javadoc.
* This is methodName
private static String methodName(String line)
}Could you please help me with this. -
How to Parse Object to DocumentBuilder??
Hi,
I am having XML contents as a Object. For reading this XML, i am using DocumentBuilder class. But this class is not supporting to parse Object. How to Parse this Object to DocumentBuilder class??
Thanks in advance....Sathishkumar.D wrote:
I got XML contents from Database and store that to a Object (java.lang.Object)..Really, you don't. You might think you do, but java.lang.Object has no means of storing this XML document. You have a subclass of Object, without knowing which class it is you can do nothing.
What does
System.out.println( "Object: "+ thisObjectOfYours.getClass() ); return?
I have to read this Object through DocumentBuilder.....
Maybe you are looking for
-
FB 4.7 Greyed out menus / Mac OS X 10.9 preview 6
Hey everyone, has any one ever seen this before? All toolbar menus are greyed out no matter what is in focus in the main application window. Any ideas?
-
Unresponsive Script: chrome://cookiemonster/content/cookieRequest.js:74 when encountering the error, the system becomes blocked, like video in still/motionless == This happened == Not sure how often == idle
-
Hi friends, I am new to SAP ABAP. I am in Delhi. I need ABAP Objects book with Mini SAP. If someone does not need it, can you give me. Regards, Navin
-
Custom Streaming Transport Settings
I can't get QT preferences to retain custom settings for Streaming Transport. I need to see if I am receiving stream via http port 80 or UDP 554. Each time I change and apply settings then close the window, re-open preference the streaming Transport
-
Is there any relation between oinv,inv1,owhs,oadm..
hi. i am developing on layout in crystal report.. oinv,inv1,owhs, are i am including.. i put parameter is DocEntry..based on this one data is comming. my question is can i add one more table oadm..... is there any relation between these four table..