Where can I obtain a sample RETS XML file? - rets

I don't have an MLS login to retrieve a live RETS XML file, but I was wondering if someone could point me in the right direction to see a sample. Are there any "sandbox" MLS servers available for non-realtors to test RETS queries against?
I'm fine with it being filled with fake/stand-in data. Just trying to extrapolate how an actual data-file would look in relation to the DTD files made-available to developers before actually hooking any code up to a live MLS.

I haven't ever looked directly at the XML response returned from RETS since I use a library like librets that abstract that away for me so I can just process the data. I found an example of some data see reference document at the end for more info:
<RETS ReplyCode="0" ReplyText="">
<COUNT Records="2117">
<DELIMITER value="09"/>
<COLUMNS> ListingID ListPrice </COLUMNS>
<DATA> 12345678 300000 </DATA>
<DATA> 23456789 300000 </DATA>
<DATA> 34567890 300000 </DATA>
<DATA> 45678901 300000 </DATA>
<DATA> 56789012 310000 </DATA>
<DATA> 67890123 310000 </DATA>
<DATA> 78901234 310000 </DATA>
<DATA> 89012345 300000 </DATA>
<DATA> 90123456 350000 </DATA>
<DATA> 01234567 400000 </DATA>
</RETS>
[1] http://www.mredllc.com/%5Crets%5Cdocuments%5CRETS%20Developer%20Start%20Guide1.pdf

It's actually a violation of all MLS rules to provide any real estate data from their servers to a developer that hasn't been approved to build tools using their data. You'd need to become a vendor with the MLS and pay the associated fees to get access to the data.
Some MLSs provide the data to you for free to be a vendor, as long as you have an Agent or Broker that will sponsor you in that MLS. Other MLSs like Northstar in Minneapolis, MRIS / BrightMLS in the DC area charge as much as $1000 a year or more.
It's very important to get a license to use the data since it's copyright.

Related

Update parameter value in XML format

I have parameters stored in an XML file. Below is a sample of the file.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<terminal id="A">
<terminalCapacity>3</terminalCapacity>
<terminalMembers id="1">
<memberID>0001</memberID>
<memberCapacity>2</memberCapacity>
</terminalMembers>
</terminal>
<terminal id="B">
<terminalCapacity>4</terminalCapacity>
<terminalMembers id="1">
<memberID>0002</memberID>
<memberCapacity>1</memberCapacity>
</terminalMembers>
<terminalMembers id="2">
<memberID>0003</memberID>
<memberCapacity>3</memberCapacity>
</terminalMembers>
</terminal>
</root>
Each terminalID is associated to a type of simpleModule found in my NED file. The idea is to programmatically update these values throughout the simulation run. The current logic revolves around getting the current parameters in XML format and update the memberCapacity field.
From the Omnet cPar and cXMLElement documentation, I tried using the par("moduleParameter").xmlValue()->getXML() function, but this returns the XML as a string. I also tried using the getAttribute() function, but to no success.
Don't do this. par("moduleParameter").xmlValue() will give you the in memory object tree of the XML document, but that is not meant for modification. Your XML file seems to be just a hierarchical structure and modules and their parameters can mirror that exactly. There is absolutely no reason to reinvent the wheel when you can mirror that with INI file parameters.

How can I generate attributes with obj2xml for ruby classes generated from xsd2ruby?

I've used the utility xsd2ruby utility provided with soap4r to generate the required classes from an XSD schema definition file. This works well, however when I try to generate an xml file using XSD::Mapping.obj2xml the attributes do not get created as I expect (or would like). I would like the following:
<obj attr1=value1 attr2=value2>
<element1>value</element1>
</obj>
but this is what gets generated:
<obj>
<__xmlattr>
<item>
<key>
<name>attr1</name>
<namespace></namespace>
<source></source>
</key>
<value>value1</value>
</item>
<item>
<key>
<name>attr2</name>
<namespace></namespace>
<source></source>
</key>
<value>value2</value>
</item>
</__xmlattr>
<element1>value</element1>
</obj>
How can I generate the XML output without the xmlattr?
From what I remember XSD::Mapping.obj2xml XML will use an instance's instance variables as element names and their values as child elements. That's all. With the instance variable #__xmlattr getting special processing, as you can see.
To get around these limitations I wrote jaxb2ruby. It generates classes based on an ERB template. You can use one of the builtin templates (ROXML, HappyMapper, or plain ruby class) or write your own.
It's not perfect but has worked out well for me in several instances.
You may also want to checkout ROAR.

Scriptella: How to handle the error while fetching data from XML through Xpath

i have one query regarding data fetching from XML xpath.
<query connection-id="in">
CommunicationCenter/Response/MenuData/Menu/Noun
<!--something I have to do inside script using the data fetched from xpath-->
</query>
My question is - suppose 1 of the XML doesn't have this structure of Xpath. It has "OtherCommCenter/MenuData/Menu/Noun" or something else structure. Then, when I run the job, it says the job is executed with no exception & as it does not get any value from xpath, nothing is happened. Means it gives back null. So, how do I catch the error there? I have to know which element in xpath creates the problem or if that is not possible, at least which xml is creating this error in structure ?
(because in my project, there are multiple XMLs I have to handle & I am doing that by submitting jobs to ExecutorService like you described in How to ETL multiple files using Scriptella?)
P.S. for the last part, I am doing like this
<connection id="in" driver="xpath" url="$input"/>
where "input" is the map key for the different xml file name.
can anybody help me? it is necessary to know asap for my project.
Here is an artificial example. Let's say there are kind of XMLs - people and cars.
people.xml:
<people>
<person></person>
</people>
Cars.xml:
<cars>
<car/>
</car>
The following xml runs 2 queries for /people/person and /cars/car and set global flags if at least one record was found:
<etl>
<connection driver="jexl" id="jexl"/>
<connection driver="xpath" id="xpath" url="input.xml"/>
<connection id="log" driver="text"/>
<query connection-id="xpath">
/people/person
<script connection-id="jexl">
# set flag to true if at least one element was found
etl.globals['people']=true;
</script>
</query>
<script connection-id="log" if="!etl.globals['people']">
WARNING: No people found in the XML file
</script>
<query connection-id="xpath">
/cars/car
<script connection-id="jexl">
etl.globals['cars']=true;
</script>
</query>
<script connection-id="log" if="!etl.globals['cars']">
WARNING: No cars found in the XML file
</script>
</etl>

Using namespace in XPath query

I have the xml file which I made a XPath request for. But it works only without the xmlns-namespace. Can You help me with the adding correct namespace qualifier (I have errors)?
xml:
<Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
<EventData>
<Data Name="ObjectServer">Security</Data>
<Data Name="ObjectType">File</Data>
<Data Name="ObjectName">C:\Temp\Project1.txt</Data>
</EventData>
</Event>
XPath:
*[EventData[Data[#Name="ObjectName" and (ends-with(text() ,".exe") or ends-with(text() ,".txt"))]]]
P.S. I'm using C++. My code based on this example from msdn. But I think its not significantly, because of I'm checking this request with online XPath tester.
Thanks.
Try this:
//*[local-name()='EventData' and ./*[local-name()='Data']
[#Name="ObjectName"and
(ends-with(text() ,".exe") or ends-with(text() ,".txt"))]]

Listing in the output in a specific crawler

i have been making xml template for a specific concern for crawling the jobs of that concern. Am using xpath for making templates but at the the runnable time the crawler is running with out giving error but with out listing the jobs
Eg:the template of Sopra technologies(the url provided in the coding)
<?xml version="1.0" encoding="UTF-8"?>
<site>
<request-type>link</request-type>
<base-url><![CDATA[http://www.in.sopragroup.com/index.htm]]></base-url>
<start-url><![CDATA[http://www.in.sopragroup.com/careers/JobListing.aspx]]>
</start-url>
<data>
<intermediate>
<navigation-request>
<navigation-type>link</navigation-type>
<url>
<xpath></xpath>
<sub-xpath></sub-xpath>
</url>
</navigation-request>
<xpath><![CDATA[//table[#class='bg_lgrey']/tbody/tr[position>2]]></xpath>
<apply-url>
<sub-xpath><![CDATA[td/#href]]></sub-xpath>
</apply-url>
<title>
<sub-xpath><![CDATA[td/a/text()]]></sub-xpath>
</title>
</intermediate>
<detail>
<xpath><![CDATA[//table[#id='tbl']/tbody]]></xpath>
<experience>
<sub-xpath><![CDATA[tr[8]/td[2]/text()]]></sub-xpath>
</experience>
<location>
<sub-xpath><![CDATA[tr[10]/td[2]/text()]]></sub-xpath>
</location>
<description>
<sub-xpath><![CDATA[tr[2]/td[2]/text()]]></sub-xpath>
</description>
</detail>
</data>
</site>
//table[#class='bg_lgrey']/tbody/tr[position>2]
This is one of the problems in the code. Such Xpath expression has chances of selecting something only if the tr element has a child named position whose string value is castable to a number with value greater than 2.
You want:
//table[#class='bg_lgrey']/tbody/tr[position() >2]
A second problem:
The string "bg_lgrey" is not present at all in the source of the pages pointed by the two urls.

Resources